package keeper

import (
	"github.com/gin-gonic/gin"
)

// SetRouter 注册路由
func SetRouter(ginRouter *gin.Engine) {
	ginRouter.StaticFile("/", assetsPath+"/etcdkeeper")
	ginRouter.Static("/framework", assetsPath+"/framework")

	v2Router := ginRouter.Group("/v2")
	{
		// v2
		v2Router.GET("/separator", getSeparator)
		v2Router.POST("/connect", connectV2)
		v2Router.POST("/put", putV2)
		v2Router.PUT("/put", putV2)
		v2Router.GET("/get", getV2)
		v2Router.POST("/delete", delV2)
		v2Router.DELETE("/delete", delV2)
		// dirctory mode
		v2Router.GET("/getpath", getPathV2)
	}

	v3Router := ginRouter.Group("/v3")
	{
		v3Router.GET("/separator", getSeparator)
		v3Router.POST("/connect", connect)
		v3Router.POST("/put", put)
		v3Router.PUT("/put", put)
		v3Router.GET("/get", get)
		v3Router.POST("/delete", del)
		v3Router.DELETE("/delete", del)
		// dirctory mode
		v3Router.GET("/getpath", getPath)
	}
}
